<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2023/10/25
  Time: 11:41
  To change this template use File | Settings | File Templates.
--%>
<%--servlet中添加resp.setContentType("text/html;charset=UTF-8")--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品信息</title>
</head>
<body>

<%!
    //    @Data
//    @AllArgsConstructor
    class Product {
        private String name;
        private String company;
        private int order;
        private String intro;
        private int state;

        public Product(String name, String company, int order, String intro, int state) {
            this.name = name;
            this.company = company;
            this.order = order;
            this.intro = intro;
            this.state = state;
        }

        public String getName() {
            return name;
        }

        public String getCompany() {
            return company;
        }

        public int getOrder() {
            return order;
        }

        public String getIntro() {
            return intro;
        }

        public int getState() {
            return state;
        }
    }
%>
<%
    Product wxr = new Product("外星人", "戴尔", 1, "不买最好的，只卖最贵的", 1);
    Product rog = new Product("ROG", "华硕", 3, "反正也挺贵", 1);
    Product mac = new Product("Mac Book Pro", "苹果", 2, "反正买不起", 0);
    Product[] products = {wxr, rog, mac};
%>

<table>
    <tr>
        <td>序号</td>
        <td>品牌名称</td>
        <td>企业名称</td>
        <td>排序</td>
        <td>品牌介绍</td>
        <td>状态</td>
        <td>操作</td>
    </tr>
    <%
        for (int i = 0; i < products.length; i++) {
            Product current = products[i];
    %>
    <tr>
        <td><%=i + 1%>
        </td>
        <td><%=current.getName()%>
        </td>
        <td><%=current.getCompany()%>
        </td>
        <td><%=current.getOrder()%>
        </td>
        <td><%=current.getIntro()%>
        </td>
        <td><%=(current.getState() == 1) ? "启用" : "禁用"%>
        </td>
        <td><a href="#">修改</a><a href="#">删除</a></td>
    </tr>
    <%
        }
    %>
</table>
</body>
</html>
